<template>
    <div class="report-content">
        <div class="header-title">
            <span>中国（南京）软件谷双创服务中心</span>
            <span>
                <a-icon type="phone" />
                400-928-4457
            </span>
        </div>
        <div class="banner">
            谷小贷企业需求诊断报告
        </div>
        <div class="small-title">
            <div class="sub-line"></div>
            <div class="diamond"></div>
            <span>诊断报告</span>
            <div class="diamond"></div>
            <div class="sub-line"></div>
        </div>
        <div class="base-info" ref="imageWrapper">
            <div>谷小贷企业需求诊断报告</div>
            <div>双创服务中心双创金融平台——让数据说话</div>
            <div class="print-btn" v-if="exportBtnVisible">
                <a-button @click="toImage" style="background: #E05059;" size="large">
                    <a-icon type="export"></a-icon>
                    打印PDF
                </a-button>
            </div>
            <div class="description">
                <div class="group">
                    <div class="point"></div>
                    <div>本报告生产时间为<span>{{ new Date() | date }}</span>，你所看到的内容为报告生成前的数据快照。</div>
                </div>
                <div class="group">
                    <div class="point"></div>
                    <div>{{ reportInfo.description }}</div>
                </div>
            </div>
            <div class="qr-code-group">
                <div class="qr-code">
                    <img src="../../assets/images/report/qq.png">
                    <div>QQ</div>
                </div>
                <div class="qr-code">
                    <img src="../../assets/images/report/wechat.png">
                    <div>微信</div>
                </div>
            </div>
            <div class="title">申请企业：<span>{{ companyInfo['base']['name'] }}</span></div>
            <div class="split-line"></div>
            <div class="menu-container">
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">基本信息：</div>
                    <div>工商信息、主要人员、分支机构、变更记录、联络信息、网站域名</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">股东信息：</div>
                    <div>股东出资信息</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">企业对外投资</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">重人安全、质呈事故、诚信记录、司法纠纷</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">财务信息：</div>
                    <div>年报信息、财务数据、税务信息、融资信息</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">知识产权：</div>
                    <div>专利信息、商标信息、证书资质、软件著作权信息、作品著作权信息</div>
                </div>
                <div class="menu-group">
                    <div class="square"></div>
                    <div class="menu-title">发展趋势：</div>
                    <div>知识产权分析、财务成长性</div>
                </div>
            </div>
            <div class="title">一、基本信息</div>
            <div class="split-line"></div>
            <a-card title="1.1 工商信息">
                <a slot="extra" href="#">企业基本信息来源：{{ extraSource }}</a>
                <div class="business-info">
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">企业名称：</span>
                            <span class="content">{{companyInfo['base']['name'] || companyApplication['companyName'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">企业标签：</span>
                            <div class="tag-content">
                                <template v-for="(item, index) in getTags()">
                                    <a-tag :color="tagColors[index % 6]" :key="index">{{ item }}</a-tag>
                                </template>
                            </div>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">英文名：</span>
                            <span class="content">{{ companyInfo['base']['enName'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">注册号：</span>
                            <span class="content">{{ companyInfo['base']['regNo'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">统一社会信用代码：</span>
                            <span class="content">{{ companyInfo['base']['creditCode'] || companyApplication['creditCode'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">营业期限：</span>
                            <span class="content">{{ companyInfo['base']['termStart'] | date }} 至 {{ companyInfo['base']['termEnd'] || '无期限' }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">法定代表人：</span>
                            <span class="content">{{ companyApplication['legalRepresentative'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">学历：</span>
                            <span class="content">{{ companyApplication['legalRepresentativeEducation'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">组织机构代码：</span>
                            <span class="content">{{ companyInfo['base']['orgCode'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">注册资本：</span>
                            <span class="content">{{ companyInfo['base']['regCapital'] | xln }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">成立时间：</span>
                            <span class="content">{{ companyInfo['base']['regDate'] || companyApplication['regDate'] | date }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">所属行业：</span>
                            <span class="content">{{ companyInfo['base']['industry'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">企业类型：</span>
                            <span class="content">{{ companyInfo['base']['econKind'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">注册地址：</span>
                            <span class="content">{{ companyInfo['base']['regAddress'] || companyApplication['regAddress'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">营业期限：</span>
                            <span class="content">{{ companyInfo['base']['termStart'] | date }} 至 {{ companyInfo['base']['termEnd'] || '无期限' }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">经营范围：</span>
                            <span class="content">{{ companyInfo['base']['businessScope'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">登记机关：</span>
                            <span class="content">{{ companyInfo['base']['belongOrg'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">核准日期：</span>
                            <span class="content">{{ companyInfo['base']['checkDate'] | date }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">股权融资：</span>
                            <span class="content">{{ companyApplication['equityFinancing'] | xls }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">股权融资计划：</span>
                            <span class="content">{{ companyApplication['equityFinancingPlan'] | xls }}</span>
                        </div>
                    </div>
                </div>
            </a-card>
            <a-card title="1.2 主要人员">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="teamInfoColumns" :data-source="companyInfo['teamInfoList']" :pagination="false" rowKey="id">
                    <template slot="footer" slot-scope="currentPageData">
                        对外投资信息及在外任职信息请查看《董监高对外投资及任职报告》。
                    </template>
                </a-table>
            </a-card>
            <a-card title="1.3 分支机构">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :column="branchOrgColumns" :data-source="[]" :pagination="false" rowKey="id"></a-table>
            </a-card>
            <a-card title="1.4 变更记录">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="changeListColumns" :data-source="companyInfo['changeList']" :pagination="false" rowKey="id">
                    <template v-slot:date="scope">
                        {{ scope | date }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="1.5 联络信息">
                <a slot="extra" href="#">数据来源：{{ reportSource }}</a>
                <div class="business-info">
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">联系人：</span>
                            <span class="content">{{ companyInfo['base']['contactName'] || companyApplication['contacts'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">联系电话：</span>
                            <span class="content">{{ companyInfo['base']['contactTel'] || companyApplication['contactNumber'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">联系地址：</span>
                            <span class="content">{{ companyInfo['base']['officeAddress'] || companyApplication['officeAddress'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">联系邮箱：</span>
                            <span class="content">--</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col" style="width: 100%;">
                            <span class="label">官网网址：</span>
                            <span class="content">{{ companyInfo['base']['internetAddress'] | xls }}</span>
                        </div>
                    </div>
                </div>
            </a-card>
            <div class="title">二、股东信息</div>
            <a-card title="2.1 股东出资信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="shareholderListColumns" :data-source="companyInfo['shareholderList']" :pagination="false" rowKey="id">
                    <template v-slot:capital="text, record">
                        {{ record.realCapi | xln }} {{ record.stockCurrency }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="2.2 年报公示">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="yearReportColumns" :data-source="getShareHolder(3)" :pagination="false" rowKey="id">
                    <template v-slot:title="currentPageData">
                        {{ new Date().getFullYear() - 3 + '年度报告' }}
                    </template>
                    <template v-slot:shouldCapital="text, record">
                        {{ record.shouldCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:shoudDate="text">
                        {{ text | date }}
                    </template>
                    <template v-slot:realCapital="text, record">
                        {{ record.realCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:realDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
                <a-table :columns="yearReportColumns" :data-source="getShareHolder(2)" :pagination="false" rowKey="id">
                    <template v-slot:title="currentPageData">
                        {{ new Date().getFullYear() - 2 + '年度报告' }}
                    </template>
                    <template v-slot:shouldCapital="text, record">
                        {{ record.shouldCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:shoudDate="text">
                        {{ text | date }}
                    </template>
                    <template v-slot:realCapital="text, record">
                        {{ record.realCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:realDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
                <a-table :columns="yearReportColumns" :data-source="getShareHolder(1)" :pagination="false" rowKey="id">
                    <template v-slot:title="currentPageData">
                        {{ new Date().getFullYear() - 1 + '年度报告' }}
                    </template>
                    <template v-slot:shouldCapital="text, record">
                        {{ record.shouldCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:shoudDate="text">
                        {{ text | date }}
                    </template>
                    <template v-slot:realCapital="text, record">
                        {{ record.realCapi | xln }} {{ record.stockCurrency }}
                    </template>
                    <template v-slot:realDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>

            <div class="title">三、企业对外投资</div>
            <a-card title="对外投资信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="investmentListColumns" :data-source="companyInfo['investmentList']" :pagination="false" rowKey="id" bordered>
                    <template v-slot:amount="text, record">
                        {{ record.subscribeQuota | xln }} {{ record.unit }}
                    </template>
                </a-table>
            </a-card>

            <div class="title">四、重大安全质量事故、诚信记录、司法纠纷公示</div>
            <a-card title="4.1 被执行人信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="executedPersonColumns" :data-source="[]" :pagination="false" rowKey="id"></a-table>
            </a-card>
            <a-card title="4.2 失信被执行人">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="dishonestyPersonListColumns" :data-source="companyInfo['dishonestyPersonList']" :pagination="false" rowKey="id">
                    <template v-slot:releaseTime="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="4.3 裁判文书信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="legalProceedingListColumns" :data-source="companyInfo['legalProceedingList']" :pagination="false" rowKey="id">
                    <template v-slot:detailLink="text">
                        <a :href="text">判决结果</a>
                    </template>
                    <template v-slot:caseDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="4.4 法院公告">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="courtAnnouncementListColumns" :data-source="companyInfo['courtAnnouncementList']" :pagination="false" rowKey="id">
                    <template v-slot:publicationTime="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>

            <div class="title">五、财务年报信息</div>
            <a-card title="企业资产状况信息">
                <a slot="extra" href="#">数据来源：{{ reportSource }}</a>
                <a-table :columns="financeListColumns" :data-source="companyInfo['financeList']" :pagination="false" rowKey="year">
                    <template v-slot:incomeSum="text">
                        {{ text | xln }}
                    </template>
                    <template v-slot:totalSales="text">
                        {{ text | xln }}
                    </template>
                    <template v-slot:totalTax="text">
                        {{ text | xln }}
                    </template>
                    <template v-slot:rdFund="text">
                        {{ text | xln }}
                    </template>
                    <template slot="footer" slot-scope="currentPageData">
                        财务报告信息
                    </template>
                </a-table>
                <div class="xl-it xl-echatrs-card">
                    <echatrs id="barX" :option="options" v-if="options.series.length"></echatrs>
                </div>
            </a-card>

            <div class="title">六、知识产权</div>
            <a-card title="6.1 专利信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="patentListColumns" :data-source="companyInfo['patentList']" :pagination="false" rowKey="id">
                    <template v-slot:applyDate="text">
                        {{ text | date }}
                    </template>
                    <template v-slot:annoDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="6.2 商标信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="brandListColumns" :data-source="companyInfo['brandList']" :pagination="false" rowKey="id"></a-table>
            </a-card>
            <a-card title="6.3 软件著作权信息">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="softwareListColumns" :data-source="companyInfo['softwareList']" :pagination="false" rowKey="id">
                    <template v-slot:regPassDate="text">
                        {{ text | date }}
                    </template>
                </a-table>
            </a-card>
            <a-card title="6.4 网站域名">
                <a slot="extra" href="#">数据来源：{{ extraSource }}</a>
                <a-table :columns="websiteListColumns" :data-source="companyInfo['websiteList']" :pagination="false" rowKey="id">
                    <template v-slot:webName="text, record">
                        <a :href="record.webUrl">{{ text }}</a>
                    </template>
                    <tempalte v-slot:auditDate="text">
                        {{ text | date }}
                    </tempalte>
                </a-table>
            </a-card>
            <div class="title">七、发展趋势</div>
            <a-card title="7.1 创新能力">
                <a slot="extra" href="#">数据来源：{{ reportSource }}</a>
                <a-row class="show-table bordered bordered-bottom-none">
                    <a-col :span="8" style="height: auto;">
                        <div class="xl-it xl-echatrs-card">
                            <echatrs id="pie" :option="pieOptions" v-if="pieOptions.series.length"></echatrs>
                        </div>
                    </a-col>
                    <a-col :span="16">
                        <a-table :columns="ipCountColumns" :data-source="getIpCountData()" :pagination="false" rowKey="name"></a-table>
                    </a-col>
                </a-row>
            </a-card>
            <a-card title="7.2 财务成长性">
                <a slot="extra" href="#">数据来源：{{ reportSource }}</a>
                <span class="ant-descriptions ant-descriptions-bordered show-table text-center">
                    <div class="ant-descriptions-view">
                        <table>
                            <tbody>
                            <tr class="ant-descriptions-row">
                                <th colspan="1" rowspan="2" class="ant-descriptions-item-label">
                                    <span>3年({{ (new Date().getFullYear() - 3) + ' ~ ' + (new Date().getFullYear() - 1) }} )</span>
                                </th>
                                <td colspan="1" class="ant-descriptions-item-content">
                                    总收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.totalIncome.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.totalIncome.type" />
                                    {{ financeRate.totalIncome.value }}
                                </td>
                                <th colspan="1" class="ant-descriptions-item-label">
                                    <span>{{ (new Date().getFullYear() - 3) + ' ~ ' + (new Date().getFullYear() - 2) }}</span>
                                </th>
                                <td colspan="1" class="ant-descriptions-item-content">
                                    总收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.firstGap.totalIncome.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.firstGap.totalIncome.type" />
                                    {{ financeRate.firstGap.totalIncome.value }}
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content">
                                    销售收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.firstGap.totalSales.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.firstGap.totalSales.type" />
                                    {{ financeRate.firstGap.totalSales.value }}
                                </td>
                            </tr>
                            <tr class="ant-descriptions-row">
                                <td colspan="1" class="ant-descriptions-item-content">
                                    销售收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.totalSales.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.totalSales.type" />
                                    {{ financeRate.totalSales.value }}
                                </td>
                                <th colspan="1" class="ant-descriptions-item-label">
                                    <span>{{ (new Date().getFullYear() - 2) + ' ~ ' + (new Date().getFullYear() - 1) }}</span>
                                </th>
                                <td colspan="1" class="ant-descriptions-item-content">
                                    总收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.secondGap.totalIncome.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.secondGap.totalIncome.type" />
                                    {{ financeRate.secondGap.totalIncome.value }}
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content">
                                    销售收入
                                </td>
                                <td colspan="1" class="ant-descriptions-item-content" :style="{color: ((financeRate.secondGap.totalSales.type == 'down') ? '#cf1322' : '#3f8600')}">
                                    <a-icon :type="'arrow-' + financeRate.secondGap.totalSales.type" />
                                    {{ financeRate.secondGap.totalSales.value }}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </span>
                <div class="xl-it xl-echatrs-card">
                    <echatrs id="barFinance" :option="financeOptions" v-if="financeOptions.series.length > 0"></echatrs>
                </div>
            </a-card>
            <div class="title">八、贷款需求</div>
            <a-card title="企业贷款需求">
                <a slot="extra" href="#">数据来源：{{ reportSource }}</a>
                <div class="business-info">
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">贷款金额：</span>
                            <span class="content">{{ companyApplication['loanAmount'] | xln }} 万元</span>
                        </div>
                        <div class="business-col">
                            <span class="label">是否有过贷款：</span>
                            <span class="content">{{ companyApplication['loanedStatus'] == '1' ? '是' : '否' }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">是否已还完：</span>
                            <span class="content">{{ companyApplication['loanCleaned'] == '1' ? '是' : '否' }}</span>
                        </div>
                        <div class="business-col">
                            <span class="label">贷款机构：</span>
                            <span class="content">{{ companyApplication['loanMechanism'] | xls }}</span>
                        </div>
                    </div>
                    <div class="business-row">
                        <div class="business-col">
                            <span class="label">过往贷款金额：</span>
                            <span class="content">{{ companyApplication['pastLoanAmount'] | xln }} 万元</span>
                        </div>
                        <div class="business-col">
                            <span class="label">过往还款金额：</span>
                            <span class="content">{{ companyApplication['pastRepaymentAmount'] | xln }} 万元</span>
                        </div>
                    </div>
                </div>
            </a-card>
        </div>
    </div>
</template>
<script>
import echatrs from '@/components/echatrs'
import html2canvas from 'html2canvas'
import jsPDF from "jspdf"
import {companyInfoGet, financeDiagnosisReportInfo, financeProductServiceApplicationDetail} from '@/assets/api/finance'

export default {
    name: 'report',
    data() {
        return {
            options: {
                series:[]
            },
            pieOptions: {
                series:[]
            },
            financeOptions: {
                series:[]
            },
            creditCode: '',
            applicationCode: '',
            companyApplication: {
                companyDevelopment:{},
                companyOperation:{}
            },
            companyInfo: {
                base: {},
                financeSummarize: {},
                companyIPCount: {}
            },
            reportInfo: {},
            exportBtnVisible: true,
            extraSource: '第三方',
            reportSource: '企业填报',
            financeRate: {
                totalIncome: {
                    type: 'up',
                    value: '0%'
                },
                totalSales: {
                    type: 'up',
                    value: '0%'
                },
                firstGap: {
                    totalIncome: {
                        type: 'up',
                        value: '0%'
                    },
                    totalSales: {
                        type: 'up',
                        value: '0%'
                    }
                },
                secondGap: {
                    totalIncome: {
                        type: 'up',
                        value: '0%'
                    },
                    totalSales: {
                        type: 'up',
                        value: '0%'
                    }
                }
            },
            tagColors:['#F68A80', '#5ECE7E', '#6ED4FF', '#F9A20C', '#7ED8D6', '#20ACFF'],
            teamInfoColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '姓名',
                    dataIndex: 'employeeName'
                },
                {
                    title: '职务',
                    dataIndex: 'position'
                }
            ],
            changeListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '变更项目',
                    dataIndex: 'changeItem',
                    width: '200px'
                },
                {
                    title: '变更日期',
                    dataIndex: 'changeTime',
                    scopedSlots: {customRender: 'date'},
                    width: '110px'
                },
                {
                    title: '变更前',
                    dataIndex: 'changeBefore'
                },
                {
                    title: '变更后',
                    dataIndex: 'changeAfter'
                }
            ],
            branchOrgColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '名称',
                    dataIndex: 'name'
                },
                {
                    title: '公司法人',
                    dataIndex: 'fr'
                },
                {
                    title: '注册时间',
                    dataIndex: 'regDate'
                },
                {
                    title: '经营状态',
                    dataIndex: 'status'
                }
            ],
            shareholderListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '股东',
                    dataIndex: 'stockName'
                },
                {
                    title: '认缴出资金额',
                    dataIndex: 'capital',
                    scopedSlots: {customRender: 'capital'},
                },
                {
                    title: '出资比例',
                    dataIndex: 'stockPercent'
                }
            ],
            yearReportColumns: [
                {
                    title: '发起人',
                    dataIndex: 'stockName'
                },
                {
                    title: '认缴金额',
                    dataIndex: 'shouldCapital',
                    scopedSlots: {customRender: 'shouldCapital'}
                },
                {
                    title: '认缴出资时间',
                    dataIndex: 'shoudDate',
                    scopedSlots: {customRender: 'shoudDate'}
                },
                {
                    title: '认缴方式',
                    dataIndex: 'investType'
                },
                {
                    title: '实缴金额',
                    dataIndex: 'realCapital',
                    scopedSlots: {customRender: 'realCapital'}
                },
                {
                    title: '实缴出资时间',
                    dataIndex: 'capiDate',
                    scopedSlots: {customRender: 'realDate'}
                },
                {
                    title: '实缴方式',
                    dataIndex: 'realInvestType'
                }
            ],
            investmentListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '企业名称',
                    dataIndex: 'comNameTzxx'
                },
                {
                    title: '法定代表人',
                    dataIndex: 'operName'
                },
                {
                    title: '统一社会信用代码/注册号',
                    dataIndex: 'comCreditCode'
                },
                {
                    title: '注册资本',
                    dataIndex: 'amount',
                    scopedSlots: {customRender: 'amount'}
                },
                {
                    title: '股权占比',
                    dataIndex: 'investmentProportion'
                }
            ],
            executedPersonColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '案号',
                    dataIndex: 'ah'
                },
                {
                    title: '执行法院',
                    dataIndex: 'zxfy'
                },
                {
                    title: '执行标的',
                    dataIndex: 'zxbd'
                },
                {
                    title: '立案时间',
                    dataIndex: 'lasj'
                }
            ],
            dishonestyPersonListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '案件编号',
                    dataIndex: 'caseNo'
                },
                {
                    title: '被执行人的履行情况',
                    dataIndex: 'performance'
                },
                {
                    title: '法律生效文书确定的义务',
                    dataIndex: 'contentOfJudgment',
                    ellipsis: true
                },
                {
                    title: '执行法院',
                    dataIndex: 'courtOfExecution'
                },
                {
                    title: '做出执行依据的单位',
                    dataIndex: 'makeExecutionBasisUnit'
                },
                {
                    title: '发布时间',
                    dataIndex: 'releaseTime',
                    width: '120px',
                    scopedSlots: {customRender: 'releaseTime'}
                }
            ],
            legalProceedingListColumns: [
                {
                    title: '判决案号',
                    dataIndex: 'caseNo'
                },
                {
                    title: '标题',
                    dataIndex: 'caseName'
                },
                {
                    title: '判决结果',
                    dataIndex: 'detailLink',
                    scopedSlots: {customRender: 'detailLink'}
                },
                {
                    title: '发布时间',
                    dataIndex: 'caseDate',
                    width: '120px',
                    scopedSlots: {customRender: 'caseDate'}
                }
            ],
            courtAnnouncementListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '公告类型',
                    dataIndex: 'announcementType'
                },
                {
                    title: '公告人',
                    dataIndex: 'lawCourt'
                },
                {
                    title: '当事人',
                    dataIndex: 'defendant'
                },
                {
                    title: '刊登日期',
                    dataIndex: 'publicationTime',
                    width: '120px',
                    scopedSlots: {customRender: 'publicationTime'}
                }
            ],
            financeListColumns: [
                {
                    title: '年份',
                    dataIndex: 'year'
                },
                {
                    title: '总收入(万元)',
                    dataIndex: 'incomeSum',
                    scopedSlots: {customRender: 'incomeSum'}
                },
                {
                    title: '总销售额(万元)',
                    dataIndex: 'totalSales',
                    scopedSlots: {customRender: 'totalSales'}
                },
                {
                    title: '总纳税额(万元)',
                    dataIndex: 'totalTax',
                    scopedSlots: {customRender: 'totalTax'}
                },
                {
                    title: '研发投入(万元)',
                    dataIndex: 'rdFund',
                    scopedSlots: {customRender: 'rdFund'}
                }
            ],
            patentListColumns: [
                {
                    title: '标题',
                    dataIndex: 'inventName'
                },
                {
                    title: '专利类型',
                    dataIndex: 'type'
                },
                {
                    title: '申请号',
                    dataIndex: 'applyNo'
                },
                {
                    title: '专利号',
                    dataIndex: 'annoNo'
                },
                {
                    title: '申请日期',
                    dataIndex: 'applyDate',
                    scopedSlots: {customRender: 'applyDate'}
                },
                {
                    title: '授权公布日期',
                    dataIndex: 'annoDate',
                    scopedSlots: {customRender: 'annoDate'}
                }
            ],
            brandListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '商标',
                    dataIndex: 'tradeName'
                },
                {
                    title: '注册号',
                    dataIndex: 'regNo'
                },
                {
                    title: '有效期限',
                    dataIndex: 'period'
                }
            ],
            softwareListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '软件全称',
                    dataIndex: 'fullName'
                },
                {
                    title: '登记号',
                    dataIndex: 'regNo'
                },
                {
                    title: '登记批准日期',
                    dataIndex: 'regPassDate',
                    scopedSlots: {customRender: 'regPassDate'}
                },
                {
                    title: '版本号',
                    dataIndex: 'pubVersion'
                }
            ],
            websiteListColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '域名',
                    dataIndex: 'webDomain'
                },
                {
                    title: '备案号',
                    dataIndex: 'recordNo'
                },
                {
                    title: '网站名称',
                    dataIndex: 'webName',
                    scopedSlots: {customRender: 'webName'}
                },
                {
                    title: '审核时间',
                    dataIndex: 'auditDate',
                    scopedSlots: {customRender: 'auditDate'}
                }
            ],
            ipCountColumns: [
                {
                    title: '序号',
                    key: 'rowIndex',
                    align: "center",
                    width: '100px',
                    customRender: function (t, r, index) {
                        return parseInt(index) + 1;
                    }
                },
                {
                    title: '能力项目',
                    dataIndex: 'name'
                },
                {
                    title: '能力值',
                    dataIndex: 'value'
                }
            ]
        }
    },
    components: {
        echatrs
    },
    watch: {
        $route(){
            this.creditCode = this.$route.query.creditCode
            this.applicationCode = this.$route.query.applicationCode
            this.$nextTick(() => {
                this.init()
            })
        }
    },
    created() {
        this.creditCode = this.$route.query.creditCode
        this.applicationCode = this.$route.query.applicationCode
        this.$nextTick(() => {
            this.init()
        })
    },
    mounted() {
    },
    methods: {
        loadBarX(res) {
            let series = [
                {
                    name: '总收入',
                    type: 'bar',
                    data: res.length ? res.map(item => item.incomeSum):[this.companyApplication.companyOperation.totalIncomeF, this.companyApplication.companyOperation.totalIncomeS, this.companyApplication.companyOperation.totalIncomeT],
                    label: {
                        show: true
                    }
                },
                {
                    name: '总销售额',
                    type: 'bar',
                    data: res.length ? res.map(item => item.totalSales):[this.companyApplication.companyOperation.totalSalesIncomeF, this.companyApplication.companyOperation.totalSalesIncomeS, this.companyApplication.companyOperation.totalSalesIncomeT],
                    label: {
                        show: true
                    }
                },
                {
                    name: '研发投入',
                    type: 'bar',
                    data: res.length ? res.map(item => item.rdFund):[this.companyApplication.companyDevelopment.developInvestF, this.companyApplication.companyDevelopment.developInvestS, this.companyApplication.companyDevelopment.developInvestT],
                    label: {
                        show: true
                    }
                },
                {
                    name: '总纳税额',
                    type: 'bar',
                    data: res.length ? res.map(item => item.totalTax):[this.companyApplication.companyOperation.totalTaxF, this.companyApplication.companyOperation.totalTaxS, this.companyApplication.companyOperation.totalTaxT],
                    label: {
                        show: true
                    }
                }
            ]
            let year = new Date().getFullYear()
            this.options = {
                legend: {
                    data: ['总收入', '总销售额', '研发投入', '总纳税额']
                },
                calculable: true,
                xAxis: [
                    {
                        type: 'category',
                        data: res.length? res.map(item => item.year): [year-3, year-2, year-1]
                    }
                ],
                yAxis: [
                    {
                        type: 'value'
                    }
                ],
                series: series
            }
        },
        loadPie(companyIPCount, brandList) {
            let series = [
                {
                    name: '占比(%)',
                    type: 'pie',
                    height: '500px',
                    width: '250px',
                    label: {
                        show: true,
                        position: 'inside',
                        formatter: '{c}'
                    },
                    labelLine: {
                        show: false
                    },
                    data: [
                        {value: companyIPCount?.iprOneNum||0, name: 'I类知识产权数量'},
                        {value: companyIPCount?.iprTwoNum||0, name: 'II类知识产权数量'},
                        {value: companyIPCount?.softwareNum||0, name: '软著数量'},
                        {value: brandList.length, name: '商标数量'},
                        {value: this.companyApplication['companyDevelopment']['patentCooperationTreatyInventionNum']||0, name: 'PCT发明数量'},
                    ]
                }
            ]
            this.pieOptions = {
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 10,
                    data: ['I类知识产权数量', 'II类知识产权数量', '软著数量', '商标数量', 'PCT发明数量']
                },
                series: series
            }
        },
        loadFinanceBar() {
            let series = [
                {
                    name: '总收入',
                    data: [this.companyApplication.companyOperation.totalIncomeF, this.companyApplication.companyOperation.totalIncomeS, this.companyApplication.companyOperation.totalIncomeT],
                    type: 'line'
                },
                {
                    name: '销售收入',
                    data: [this.companyApplication.companyOperation.totalSalesIncomeF, this.companyApplication.companyOperation.totalSalesIncomeS, this.companyApplication.companyOperation.totalSalesIncomeT],
                    type: 'line'
                }
            ]
            let currentYear = new Date().getFullYear()
            this.financeOptions = {
                legend: {
                    data: ['总收入', '销售收入']
                },
                tooltip: {
                    trigger: 'axis'
                },
                label: {
                    show: true
                },
                xAxis: {
                    type: 'category',
                    data: [currentYear - 3, currentYear - 2, currentYear - 1]
                },
                yAxis: {
                    type: 'value'
                },
                series: series
            }
        },
        toImage() {
            this.exportBtnVisible = false
            setTimeout(() => {
                html2canvas(this.$refs.imageWrapper)
                    .then(function (canvas) {
                        let pdf = new jsPDF('p', 'mm', 'a4')    //A4纸，纵向
                        let ctx = canvas.getContext('2d'),
                            a4w = 190, a4h = 277,    //A4大小，210mm x 297mm，四边各保留10mm的边距，显示区域190x277
                            imgHeight = Math.floor(a4h * canvas.width / a4w),    //按A4显示比例换算一页图像的像素高度
                            renderedHeight = 0
                        while (renderedHeight < canvas.height) {
                            let page = document.createElement("canvas")
                            page.width = canvas.width
                            page.height = Math.min(imgHeight, canvas.height - renderedHeight) //可能内容不足一页
                            //用getImageData剪裁指定区域，并画到前面创建的canvas对象中
                            page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0)
                            pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 10, 10, a4w, Math.min(a4h, a4w * page.height / page.width))    //添加图像到页面，保留10mm边距
                            renderedHeight += imgHeight
                            if (renderedHeight < canvas.height)
                                pdf.addPage() //如果后面还有内容，添加一个空页
                            page = null
                        }
                        pdf.save('content.pdf')
                        this.exportBtnVisible = true
                    }).catch(_ => {
                    this.exportBtnVisible = true
                })
            }, 100)

        },
        getTags() {
            let data = []
            if (this.companyInfo.companyTagHtInfoList && this.companyInfo.companyTagHtInfoList.length) {
                data.push('高企')
            }
            // return ['高企', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜', '软件人才', '新颜']
            return data
        },
        getShareHolder(num) {
            let data = []
            let year = (new Date()).getFullYear() - num
            if (this.companyInfo['shareholderList']) {
                data = this.companyInfo['shareholderList'].filter(item => {
                    if (!item.capiDate) {
                        return false
                    }
                    let capiDate = new Date(item.capiDate)
                    return capiDate.getFullYear() == year
                })
            }
            return data
        },
        getFinanceRate() {
            this.financeRate.totalIncome = this.getRate('totalIncomeF','totalIncomeS','totalIncomeT')
            this.financeRate.totalSales = this.getRate('totalSalesIncomeF', 'totalSalesIncomeS', 'totalSalesIncomeT')
            this.financeRate.firstGap.totalIncome = this.getRate('totalIncomeF', 'totalIncomeS')
            this.financeRate.firstGap.totalSales = this.getRate('totalSalesIncomeF', 'totalSalesIncomeS')
            this.financeRate.secondGap.totalIncome = this.getRate('totalIncomeS', 'totalIncomeT')
            this.financeRate.secondGap.totalSales = this.getRate('totalSalesIncomeS', 'totalSalesIncomeT')
        },
        getRate(propF, propS, propT) {
            let result = {
                type: 'up',
                value: '0%'
            }
            let financeSummarize = this.companyApplication.companyOperation
            let oldData = financeSummarize[propF]
            let newData = financeSummarize[propT] || financeSummarize[propS] || financeSummarize[propF]
            if (oldData && newData) {
                let value = Math.abs(((newData - oldData) / oldData * 100).toFixed(2)) + '%'
                let type = newData > oldData ? 'up' : 'down'
                result.type = type
                result.value = value
            }
            return result
        },
        getIpCountData() {
            return [
                {
                    name: 'I类知识产权数量',
                    value: this.companyInfo['companyIPCount']?.iprOneNum || 0
                },
                {
                    name: 'II类知识产权数量',
                    value: this.companyInfo?.companyIPCount?.iprTwoNum || 0
                },
                {
                    name: '软著数量',
                    value: this.companyInfo?.companyIPCount?.softwareNum || 0
                },
                {
                    name: '商标数量',
                    value: this.companyInfo?.brandList?.length || 0
                },
                {
                    name: 'PCT发明数量',
                    value: this.companyApplication['companyDevelopment']['patentCooperationTreatyInventionNum'] || 0
                },
            ]
        },
        init() {
            financeProductServiceApplicationDetail({param: this.applicationCode}).then(res => {
                this.companyApplication = res.result
            }).then(_ => {
                companyInfoGet({param: this.creditCode}).then(res => {
                    let year = new Date().getFullYear()
                    // 财务报告信息年份升序
                    if (res.result) {
                        res.result.financeList = res.result.financeList.sort(function (a, b) {
                            return a.year - b.year
                        })
                        this.companyInfo = res.result
                        this.companyInfo.financeList = [
                            {
                                year: year - 3,
                                incomeSum: this.companyApplication.companyOperation.totalIncomeF,
                                totalSales: this.companyApplication.companyOperation.totalSalesIncomeF,
                                totalTax: this.companyApplication.companyOperation.totalTaxF,
                                rdFund: this.companyApplication.companyDevelopment.developInvestF
                            },
                            {
                                year: year - 2,
                                incomeSum: this.companyApplication.companyOperation.totalIncomeS,
                                totalSales: this.companyApplication.companyOperation.totalSalesIncomeS,
                                totalTax: this.companyApplication.companyOperation.totalTaxS,
                                rdFund: this.companyApplication.companyDevelopment.developInvestS
                            },
                            {
                                year: year - 1,
                                incomeSum: this.companyApplication.companyOperation.totalIncomeT,
                                totalSales: this.companyApplication.companyOperation.totalSalesIncomeT,
                                totalTax: this.companyApplication.companyOperation.totalTaxT,
                                rdFund: this.companyApplication.companyDevelopment.developInvestT
                            }
                        ]
                    }
                    this.loadBarX([])
                    this.loadPie(res.result ? res.result['companyIPCount'] : null, res.result ? res.result['brandList'] : [])
                    this.getFinanceRate()
                    this.loadFinanceBar()
                }).then(_ => {
                    financeDiagnosisReportInfo().then(data => {
                        this.reportInfo = data.result
                    })
                })

            })
        }
    }
}
</script>
<style lang="less">
.report-content {
    width: 100%;
    height: unset !important;
    min-width: 1200px;
    background: url('~@/assets/images/report/backimage.png') center top no-repeat;
    background-size: cover;
    .header-title {
        display: flex;
        justify-content: space-around;
        height: 60px;
        background-color: #20ABFF;
        padding: 0;
        font-size: 16px;
        color: #FFFFFF;
        span {
            height: 60px;
            line-height: 60px;
        }
    }

    .banner {
        position: relative;
        width: fit-content;
        height: 70px;
        text-align: center;
        font-size: 70px;
        font-weight: bold;
        color: #1678B6;
        line-height: 70px;
        margin: 75px auto;
        background: linear-gradient(0deg, #20ACFF 1.78125%, #FFFFFF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .small-title {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: #FFFFFF;
        .sub-line {
            width: 262px;
            height: 2px;
            background: linear-gradient(-90deg, #209AE2, #0C325A);
        }
        .diamond {
            width: 10px;
            height: 10px;
            background: #209AE2;
            transform: rotate(45deg);
        }
        .sub-line:last-of-type {
            transform: rotate(180deg);
        }
        span {
            margin: 0 10px;
        }
    }

    .split-line {
        width: 100%;
        height: 1px;
        background: #EEEEEE;
    }

    .ant-card {
        margin-top: 20px;
        .ant-card-body {
            padding: 0;
        }
    }

    .ant-table {
        .ant-table-body {
            th {
                background: #F6F3F7;
            }
        }
        .ant-table-title {
            padding: 7px 16px;
            font-size: 16px;
        }
        .ant-table-footer {
            background: #F6F3F7;
        }
    }

    .base-info {
        position: relative;
        width: 1200px;
        background: #FFFFFF;
        box-shadow: 1px 4px 16px 0px rgba(227, 227, 227, 0.75);
        border-radius: 10px;
        margin: 50px auto;
        padding: 0px 50px 50px;
        font-size: 15px;

        .print-btn {
            position: absolute;
            right: 73px;
            top: 33px;
        }

        >div:nth-child(1) {
            text-align: center;
            font-size: 25px;
            font-weight: 600;
            color: rgba(50, 50, 50);
            line-height: 100px;
        }

        >div:nth-child(2) {
            text-align: center;
            font-size: 16px;
            color: #FFFFFF;
            line-height: 35px;
            background-color: #1A7FBC;
            width: 355px;
            margin: 0px auto 40px;
        }

        .description {
            font-size: 16px;
            color: #787878;
            padding: 0px;
            .group {
                display: flex;
                .point {
                    width: 8px;
                    height: 8px;
                    background: #1A80BC;
                    border-radius: 50%;
                    margin-right: 5px;
                    margin-top: 8px;
                }
                >div:nth-child(2) {
                    width: calc(100% - 10px);
                }
                &:nth-of-type(2) {
                    margin-top: 20px;
                }
            }
        }

        .qr-code-group {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 20px 0px;
            img {
                width: 100px;
                margin: auto;
            }
            .qr-code {
                display: flex;
                flex-direction: column;
                align-content: center;
                >div {
                    text-align: center;
                    width: 250px;
                }
            }
        }

        .title {
            font-size: 18px;
            font-weight: bold;
            line-height: 50px;
            margin-top: 10px;
        }

        .sub-title {
            font-size: 16px;
            font-weight: bold;
            line-height: 45px;
        }

        .menu-container {
            font-size: 15px;
            .menu-group {
                display: flex;
                align-items: center;
                margin-top: 8px;
                .square {
                    width: 10px;
                    height: 10px;
                    background: #1A80BC;
                    margin-right: 5px;
                }
                .menu-title{
                    font-weight: bold;
                }
            }
        }

        .business-info {
            .business-row {
                font-size: 16px;
                color: #252525;
                line-height: 57px;
                background: #FFFFFF;
                display: flex;
                padding: 0px 50px;
                &:nth-child(2n - 1) {
                    background: #F6F3F7;
                }
                .business-col {
                    display: flex;
                    align-items: center;
                    width: 50%;
                    .label {
                        font-weight: bold;
                    }
                    .content {
                        margin-left: 15px;
                        max-width: 850px;
                    }
                    .tag-content {
                        margin-left: 15px;
                        max-width: 850px;
                    }
                }
            }
        }

        .xl-echatrs-card {
            padding-top: 20px;
        }
    }

    .text-center {
        text-align: center !important;
    }

    .show-table {
        .ant-descriptions-view {
            border-radius: unset;
            padding: 0px !important;
            .ant-descriptions-item-label {
                min-width: 180px;
                font-weight: bold;
                background: #F6F3F7;
            }
            .ant-descriptions-item-content {
                min-width: unset;
                padding: 15px !important;
            }
        }
    }
}

</style>